package org.lex.game.sudoku.view.cell;

import java.awt.Color;

public class CellResource {
	private static final CellResource DEFAULT;

	static {
		DEFAULT = new CellResource();
		// foreground
		DEFAULT.normalForeground = Color.BLACK;
		DEFAULT.editableForeground = Color.BLUE;
		DEFAULT.selectedForeground = Color.BLACK;
		DEFAULT.hintForeground = Color.LIGHT_GRAY;
		DEFAULT.errorForeground = Color.BLACK;

		// background
		DEFAULT.normalBackground = Color.LIGHT_GRAY;
		DEFAULT.editableBackground = Color.WHITE;
		DEFAULT.selectedBackground = Color.YELLOW;
		DEFAULT.hintBackground = Color.WHITE;
		DEFAULT.errorBackground = Color.RED;
	}

	public static CellResource getDefault() {
		return DEFAULT;
	}

	private Color fallbackBackground = null;
	private Color fallbackForeground = null;

	private Color normalBackground = null;
	private Color normalForeground = null;

	private Color editableBackground = null;
	private Color editableForeground = null;

	private Color selectedBackground = null;
	private Color selectedForeground = null;

	private Color hintBackground = null;
	private Color hintForeground = null;

	private Color errorBackground = null;
	private Color errorForeground = null;

	public CellResource() {
		this(Color.BLACK, Color.WHITE);
	}

	public CellResource(Color fallbackFgColor, Color fallbackBgColor) {
		this.fallbackForeground = fallbackFgColor;
		this.fallbackBackground = fallbackBgColor;
	}

	public Color getFallbackBackground() {
		return fallbackBackground;
	}

	public void setFallbackBackground(Color fallbackBackground) {
		this.fallbackBackground = fallbackBackground;
	}

	public Color getFallbackForeground() {
		return fallbackForeground;
	}

	public void setFallbackForeground(Color fallbackForeground) {
		this.fallbackForeground = fallbackForeground;
	}

	public Color getNormalBackground() {
		return null == normalBackground ? this.fallbackBackground : this.normalBackground;
	}

	public void setNormalBackground(Color normalBackground) {
		this.normalBackground = normalBackground;
	}

	public Color getNormalForeground() {
		return null == normalForeground ? this.fallbackForeground : this.normalForeground;
	}

	public void setNormalForeground(Color normalForeground) {
		this.normalForeground = normalForeground;
	}

	public Color getEditableBackground() {
		return null == editableBackground ? this.fallbackBackground : this.editableBackground;
	}

	public void setEditableBackground(Color editableBackground) {
		this.editableBackground = editableBackground;
	}

	public Color getEditableForeground() {
		return null == editableForeground ? this.fallbackForeground : this.editableForeground;
	}

	public void setEditableForeground(Color editableForeground) {
		this.editableForeground = editableForeground;
	}

	public Color getSelectedBackground() {
		return null == selectedBackground ? this.fallbackBackground : this.selectedBackground;
	}

	public void setSelectedBackground(Color selectedBackground) {
		this.selectedBackground = selectedBackground;
	}

	public Color getSelectedForeground() {
		return null == selectedForeground ? this.fallbackForeground : this.selectedForeground;
	}

	public void setSelectedForeground(Color selectedForeground) {
		this.selectedForeground = selectedForeground;
	}

	public Color getHintBackground() {
		return null == hintBackground ? this.fallbackBackground : this.hintBackground;
	}

	public void setHintBackground(Color hintBackground) {
		this.hintBackground = hintBackground;
	}

	public Color getHintForeground() {
		return null == hintForeground ? this.fallbackForeground : this.hintForeground;
	}

	public void setHintForeground(Color hintForeground) {
		this.hintForeground = hintForeground;
	}

	public Color getErrorBackground() {
		return null == errorBackground ? this.fallbackBackground : this.errorBackground;
	}

	public void setErrorBackground(Color errorBackground) {
		this.errorBackground = errorBackground;
	}

	public Color getErrorForeground() {
		return null == errorForeground ? this.fallbackForeground : this.errorForeground;
	}

	public void setErrorForeground(Color errorForeground) {
		this.errorForeground = errorForeground;
	}
}
